// JavaScript Document
$(document).ready(function(){
	/*========================================
		** 	window width adjustment  **
	=========================================*/
	
	var pageWidth = $(window).width();
	if (pageWidth < 1024) {
		$('.container').css({'width': '940px', 'padding': '0 20px'});
		$('.footer').css({'width': '980px', 'margin-left': '-20px'});
	}
	
	
	
	
	/*========================================
		** 	Logos slides  **
	=========================================*/
	function tick(){
		$('#ticker li:first').slideUp("slow", function(){
			$(this).appendTo($('#ticker')).slideDown(); 
		});
	}
	setInterval(function(){ tick () }, 5000);
	
	/*========================================
		** 	Adjustments  **
	=========================================*/
	$( "h2" ).has( "sup" ).addClass( "sup" );
	$( ".bullet li " ).prepend('<span class="icon"></span>');
	$( ".bullet li" ).wrapInner( "<div class='text'></div>");
	$('.bullet li span.icon').each(function() {
				$(this).parent().before(this);
	});
		
});


	/*========================================
		** 	Sliders  **
	=========================================*/
$(window).load(function(){
      $('.main-slider').flexslider({
		animation: "fade",
		directionNav: false,
		controlNav: false,
		animationSpeed: 900,
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
	  
	  $('.board').flexslider({
		animation: "fade",
		directionNav: false,
		controlNav: false,
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
	  
	  $('.board2').flexslider({
		animation: "fade",
		directionNav: false,
		controlNav: false,
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
	  
	  $('.organizer').flexslider({
		animation: "fade",
		directionNav: false,
		controlNav: false,
        start: function(slider){
          $('body').removeClass('loading');
        }
      });
	  
	  
	  var total = $('.gallery li').length;
	  $('span.total').text(' / ' + total);
	  
	  $('.gallery').flexslider({
		animation: "fade",
		directionNav: true,
		prevText: "",
		nextText: "",
		controlNav: false,
        start: function(slider){
          $('span.index').text(slider.count);
   	 	$('span.index').text(slider.currentSlide);
    	$('span.index').text(function(i,txt) { return parseInt(txt, 10) + 1; } );
        },
  		after: function(slider) {
    	$('span.index').text(slider.currentSlide);
    	$('span.index').text(function(i,txt) { return parseInt(txt, 10) + 1; });
		}
      });
	  // 
	  
    });
